/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package eproject_sem2;

import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JInternalFrame;

/**
 *
 * @author ZER0
 */
public class VotesSent extends javax.swing.JFrame {

    VotesSent_Sever s = new VotesSent_Sever();
    String TableP = "Prices_by_Area";
    String TableT = "List_of_Parce";
    String TableW = "Prices_by_weight";
    public static String To, From, Typeparce, GWName, Waybill, Date, Deliveryaddress, CustomersID, CName, CAddress;
    public static float Costsincurred, PWeight, PD, Shippingfee, Totalamount;
    public static int Phone;

    public static String getCAddress() {
        return CAddress;
    }

    public static String getCName() {
        return CName;
    }

    public static float getCostsincurred() {
        return Costsincurred;
    }

    public static String getCustomersID() {
        return CustomersID;
    }

    public static String getDate() {
        return Date;
    }

    public static String getDeliveryaddress() {
        return Deliveryaddress;
    }

    public static String getFrom() {
        return From;
    }

    public static String getGWName() {
        return GWName;
    }

    public static float getPWeight() {
        return PWeight;
    }

    public static int getPhone() {
        return Phone;
    }

    public static float getShippingfee() {
        return Shippingfee;
    }

    public static String getTo() {
        return To;
    }

    public static float getTotalamount() {
        return Totalamount;
    }

    public static String getTypeparce() {
        return Typeparce;
    }

    public static String getWaybill() {
        return Waybill;
    }

    public JInternalFrame getItfVS() {
        return itfVS;
    }
    public static boolean RS ;

    public static boolean isRS() {
        return RS;
    }

    public VotesSent() throws SQLException, ClassNotFoundException {
        initComponents();
        RS=true;
        s.AddDatainJComboBox(TableP, cbxFrom);
        s.AddDatainJComboBox(TableP, cbxTo);
        s.AddDatainJComboBox(TableT, cbTypeparce);
        s.AddDatainJComboBox(TableW, cbWeight);
        txtPhoneN.setText("00");
        lbWaybill1.setText(s.CreateID("VotesSent", "WB"));
        lbDate1.setText(s.GetDate());
        txtCustomersID.setText(s.CreateID("Customer", "HN"));
        tfCostsincurred.setText(Float.toString(0));
        tfShippingfee.setEditable(false);
        tfTotalamount.setEditable(false);
        txtCustomersID.setEditable(false);
        lbEmployeeV.setText(Interface.getEN());
        tfCostsincurred.addFocusListener(new FocusListener() {

            @Override
            public void focusGained(FocusEvent e) {
            }

            @Override
            public void focusLost(FocusEvent e) {
                To = (String) cbxTo.getSelectedItem();
                From = (String) cbxFrom.getSelectedItem();
                Typeparce = (String) cbTypeparce.getSelectedItem();
                GWName = (String) cbWeight.getSelectedItem();
                Costsincurred = Float.parseFloat(tfCostsincurred.getText());
                try {
                    PWeight = s.GetPrice(GWName, TableW);
                    PD = s.GetPriceDistance(s.Getdistance(To, From, "Prices_by_Area"), "Prices_by_distance");
                    Shippingfee = s.Shippingfee(PD, s.GetPrice(Typeparce, TableT), PWeight);
                    Totalamount = s.Totalamount(Shippingfee, Costsincurred);
                    tfTotalamount.setText(Float.toString(Shippingfee));
                    tfShippingfee.setText(Float.toString(Totalamount));
                } catch (SQLException ex) {
                    Logger.getLogger(VotesSent.class.getName()).log(Level.SEVERE, null, ex);
                } catch (ClassNotFoundException ex) {
                    Logger.getLogger(VotesSent.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jDesktopPane1 = new javax.swing.JDesktopPane();
        itfVS = new javax.swing.JInternalFrame();
        lbEmployeeT = new javax.swing.JLabel();
        btnNew = new javax.swing.JButton();
        jpInformationvotessent = new javax.swing.JPanel();
        lbCustomersID = new javax.swing.JLabel();
        lbCustomerName = new javax.swing.JLabel();
        lbDiachiKH = new javax.swing.JLabel();
        txtCustomersID = new javax.swing.JTextField();
        txtCustomerName = new javax.swing.JTextField();
        txtPhoneN = new javax.swing.JTextField();
        lbPhoneN = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        txtaCAddress = new javax.swing.JTextArea();
        lbDate = new javax.swing.JLabel();
        lbWaybill = new javax.swing.JLabel();
        btADD = new javax.swing.JButton();
        lbVS = new javax.swing.JLabel();
        jpCheckout = new javax.swing.JPanel();
        lbWeight = new javax.swing.JLabel();
        lbShippingfee = new javax.swing.JLabel();
        lbCostsincurred = new javax.swing.JLabel();
        lbTotalamount = new javax.swing.JLabel();
        tfShippingfee = new javax.swing.JTextField();
        tfCostsincurred = new javax.swing.JTextField();
        tfTotalamount = new javax.swing.JTextField();
        lbUCostsincurred = new javax.swing.JLabel();
        lbUShippingfee = new javax.swing.JLabel();
        lbUTotalamount = new javax.swing.JLabel();
        cbWeight = new javax.swing.JComboBox();
        lbEmployeeV = new javax.swing.JLabel();
        jpInformationparcel = new javax.swing.JPanel();
        lbDeliveryaddress = new javax.swing.JLabel();
        lbTypeparce = new javax.swing.JLabel();
        tfDeliveryaddress = new javax.swing.JTextField();
        lblTo = new javax.swing.JLabel();
        cbxTo = new javax.swing.JComboBox();
        cbTypeparce = new javax.swing.JComboBox();
        lblFrom = new javax.swing.JLabel();
        cbxFrom = new javax.swing.JComboBox();
        lbDate1 = new javax.swing.JLabel();
        lbWaybill1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setResizable(false);

        itfVS.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        itfVS.setClosable(true);
        itfVS.setFocusable(false);
        itfVS.setVisible(true);

        lbEmployeeT.setText("Employee transaction:");

        btnNew.setIcon(new javax.swing.ImageIcon(getClass().getResource("/eproject_sem2/Icon/images.png"))); // NOI18N
        btnNew.setText("New");
        btnNew.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNewActionPerformed(evt);
            }
        });

        jpInformationvotessent.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Information votes sent", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14), new java.awt.Color(0, 0, 0))); // NOI18N

        lbCustomersID.setText("CustomersID:");

        lbCustomerName.setText("Customer Name:");

        lbDiachiKH.setText("Customer Address:");

        txtCustomersID.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtCustomersIDActionPerformed(evt);
            }
        });
        txtCustomersID.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtCustomersIDKeyReleased(evt);
            }
        });

        txtCustomerName.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtCustomerNameKeyReleased(evt);
            }
        });

        txtPhoneN.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtPhoneNKeyReleased(evt);
            }
        });

        lbPhoneN.setText("Phone number:");

        txtaCAddress.setColumns(20);
        txtaCAddress.setRows(5);
        jScrollPane2.setViewportView(txtaCAddress);

        javax.swing.GroupLayout jpInformationvotessentLayout = new javax.swing.GroupLayout(jpInformationvotessent);
        jpInformationvotessent.setLayout(jpInformationvotessentLayout);
        jpInformationvotessentLayout.setHorizontalGroup(
            jpInformationvotessentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpInformationvotessentLayout.createSequentialGroup()
                .addGap(34, 34, 34)
                .addGroup(jpInformationvotessentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lbCustomerName)
                    .addComponent(lbCustomersID)
                    .addComponent(lbPhoneN))
                .addGap(18, 18, 18)
                .addGroup(jpInformationvotessentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtCustomerName, javax.swing.GroupLayout.DEFAULT_SIZE, 249, Short.MAX_VALUE)
                    .addComponent(txtCustomersID)
                    .addComponent(txtPhoneN))
                .addGap(18, 18, 18)
                .addComponent(lbDiachiKH)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 249, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(50, Short.MAX_VALUE))
        );
        jpInformationvotessentLayout.setVerticalGroup(
            jpInformationvotessentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpInformationvotessentLayout.createSequentialGroup()
                .addGroup(jpInformationvotessentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpInformationvotessentLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jpInformationvotessentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtCustomersID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lbCustomersID))
                        .addGap(18, 18, 18)
                        .addGroup(jpInformationvotessentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lbCustomerName)
                            .addComponent(txtCustomerName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jpInformationvotessentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lbPhoneN)
                            .addComponent(txtPhoneN, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jpInformationvotessentLayout.createSequentialGroup()
                        .addGap(21, 21, 21)
                        .addGroup(jpInformationvotessentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lbDiachiKH)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(29, Short.MAX_VALUE))
        );

        lbDate.setText("Date:");

        lbWaybill.setText("Waybill:");

        btADD.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        btADD.setIcon(new javax.swing.ImageIcon(getClass().getResource("/eproject_sem2/Icon/Open-Folder-Add-icon.png"))); // NOI18N
        btADD.setText("ADD");
        btADD.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btADDActionPerformed(evt);
            }
        });

        lbVS.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
        lbVS.setForeground(new java.awt.Color(255, 102, 102));
        lbVS.setText("VOTES SENT");

        jpCheckout.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Checkout", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N

        lbWeight.setText("Weight:");

        lbShippingfee.setText("Shipping fee:");

        lbCostsincurred.setText("Costsincurred:");

        lbTotalamount.setText("Total amount:");

        tfCostsincurred.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tfCostsincurredActionPerformed(evt);
            }
        });
        tfCostsincurred.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                tfCostsincurredKeyReleased(evt);
            }
        });

        lbUCostsincurred.setText("000vnd");

        lbUShippingfee.setText("000vnd");

        lbUTotalamount.setText("000vnd");

        javax.swing.GroupLayout jpCheckoutLayout = new javax.swing.GroupLayout(jpCheckout);
        jpCheckout.setLayout(jpCheckoutLayout);
        jpCheckoutLayout.setHorizontalGroup(
            jpCheckoutLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpCheckoutLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpCheckoutLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lbCostsincurred)
                    .addComponent(lbShippingfee)
                    .addComponent(lbWeight)
                    .addComponent(lbTotalamount))
                .addGap(18, 18, 18)
                .addGroup(jpCheckoutLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(tfCostsincurred)
                    .addComponent(tfShippingfee)
                    .addComponent(cbWeight, 0, 210, Short.MAX_VALUE)
                    .addComponent(tfTotalamount))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(jpCheckoutLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbUShippingfee, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lbUCostsincurred, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lbUTotalamount, javax.swing.GroupLayout.Alignment.TRAILING))
                .addGap(18, 18, 18))
        );
        jpCheckoutLayout.setVerticalGroup(
            jpCheckoutLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpCheckoutLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpCheckoutLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbWeight)
                    .addComponent(cbWeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(14, 14, 14)
                .addGroup(jpCheckoutLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfCostsincurred, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbCostsincurred)
                    .addComponent(lbUCostsincurred))
                .addGap(9, 9, 9)
                .addGroup(jpCheckoutLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbShippingfee)
                    .addComponent(tfShippingfee, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbUShippingfee))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jpCheckoutLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfTotalamount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbTotalamount)
                    .addComponent(lbUTotalamount))
                .addGap(0, 0, Short.MAX_VALUE))
        );

        lbEmployeeV.setText("xxxxx");

        jpInformationparcel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Information parcel", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N
        jpInformationparcel.setPreferredSize(new java.awt.Dimension(440, 160));

        lbDeliveryaddress.setText("Delivery address:");

        lbTypeparce.setText("Type Parce:");

        tfDeliveryaddress.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                tfDeliveryaddressKeyReleased(evt);
            }
        });

        lblTo.setText("To:");

        lblFrom.setText("From:");

        javax.swing.GroupLayout jpInformationparcelLayout = new javax.swing.GroupLayout(jpInformationparcel);
        jpInformationparcel.setLayout(jpInformationparcelLayout);
        jpInformationparcelLayout.setHorizontalGroup(
            jpInformationparcelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpInformationparcelLayout.createSequentialGroup()
                .addGroup(jpInformationparcelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpInformationparcelLayout.createSequentialGroup()
                        .addGap(66, 66, 66)
                        .addGroup(jpInformationparcelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(lblFrom)
                            .addComponent(lblTo)))
                    .addGroup(jpInformationparcelLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(lbDeliveryaddress))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpInformationparcelLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(lbTypeparce)))
                .addGap(18, 18, 18)
                .addGroup(jpInformationparcelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(cbxTo, 0, 258, Short.MAX_VALUE)
                    .addComponent(tfDeliveryaddress)
                    .addComponent(cbTypeparce, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(cbxFrom, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(32, Short.MAX_VALUE))
        );
        jpInformationparcelLayout.setVerticalGroup(
            jpInformationparcelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpInformationparcelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpInformationparcelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblFrom)
                    .addComponent(cbxFrom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jpInformationparcelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbxTo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblTo))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jpInformationparcelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbDeliveryaddress)
                    .addComponent(tfDeliveryaddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jpInformationparcelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbTypeparce, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbTypeparce))
                .addContainerGap(41, Short.MAX_VALUE))
        );

        lbDate1.setText("x/x/x");

        lbWaybill1.setText("xxxx");

        javax.swing.GroupLayout itfVSLayout = new javax.swing.GroupLayout(itfVS.getContentPane());
        itfVS.getContentPane().setLayout(itfVSLayout);
        itfVSLayout.setHorizontalGroup(
            itfVSLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(itfVSLayout.createSequentialGroup()
                .addGap(54, 54, 54)
                .addComponent(lbVS)
                .addGap(263, 263, 263)
                .addGroup(itfVSLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lbWaybill)
                    .addComponent(lbDate)
                    .addComponent(lbEmployeeT))
                .addGroup(itfVSLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(itfVSLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addGroup(itfVSLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lbEmployeeV)
                            .addComponent(lbDate1)))
                    .addGroup(itfVSLayout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(lbWaybill1)))
                .addGap(115, 156, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, itfVSLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(itfVSLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, itfVSLayout.createSequentialGroup()
                        .addComponent(btADD, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(62, 62, 62)
                        .addComponent(btnNew, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(92, 92, 92))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, itfVSLayout.createSequentialGroup()
                        .addGroup(itfVSLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(itfVSLayout.createSequentialGroup()
                                .addComponent(jpInformationparcel, javax.swing.GroupLayout.PREFERRED_SIZE, 414, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jpCheckout, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jpInformationvotessent, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(20, 20, 20))))
        );
        itfVSLayout.setVerticalGroup(
            itfVSLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(itfVSLayout.createSequentialGroup()
                .addGroup(itfVSLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(itfVSLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(itfVSLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lbWaybill1)
                            .addComponent(lbWaybill, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(itfVSLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lbDate1)
                            .addComponent(lbDate))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(itfVSLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lbEmployeeV)
                            .addComponent(lbEmployeeT)))
                    .addComponent(lbVS, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jpInformationvotessent, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(itfVSLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jpCheckout, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jpInformationparcel, javax.swing.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(itfVSLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnNew)
                    .addComponent(btADD))
                .addContainerGap(37, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(itfVS)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(itfVS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btADDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btADDActionPerformed

        // TODO add your handling code here:

        Waybill = lbWaybill1.getText();
        Date = lbDate1.getText();
        Deliveryaddress = tfDeliveryaddress.getText();
        CustomersID = txtCustomersID.getText();
        CName = txtCustomerName.getText();
        CAddress = txtaCAddress.getText();
        Phone = Integer.parseInt(txtPhoneN.getText());
        try {
             
            new Information_VS().setVisible(true);

        } catch (SQLException ex) {
            Logger.getLogger(VotesSent.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(VotesSent.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_btADDActionPerformed

    private void tfCostsincurredActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tfCostsincurredActionPerformed

        tfTotalamount.setText(Float.toString(Shippingfee));
        tfShippingfee.setText(Float.toString(Totalamount));
    }//GEN-LAST:event_tfCostsincurredActionPerformed

    private void txtCustomersIDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCustomersIDActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtCustomersIDActionPerformed

    private void tfCostsincurredKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tfCostsincurredKeyReleased
        // TODO add your handling code here:
        tfCostsincurred.setText(tfCostsincurred.getText().replaceAll("[a-zA-Z!@#$%^&*()=+]", ""));
    }//GEN-LAST:event_tfCostsincurredKeyReleased

    private void txtCustomersIDKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCustomersIDKeyReleased
        txtCustomersID.setText(txtCustomersID.getText().replaceAll("[!@#$%^&*()=+]", ""));
   }//GEN-LAST:event_txtCustomersIDKeyReleased

    private void tfDeliveryaddressKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tfDeliveryaddressKeyReleased
        tfDeliveryaddress.setText(tfDeliveryaddress.getText().replaceAll("[!@#$%^&*()=+]", ""));
    }//GEN-LAST:event_tfDeliveryaddressKeyReleased

    private void btnNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewActionPerformed
        try {
            // TODO add your handling code here:
            lbWaybill1.setText(s.CreateID("VotesSent", "WB"));
            txtCustomersID.setText(s.CreateID("Customer", "HN"));
            tfTotalamount.setText(null);
            tfShippingfee.setText(null);
            txtCustomerName.setText(null);
            txtaCAddress.setText(null);
        } catch (Exception ex) {
            Logger.getLogger(VotesSent.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_btnNewActionPerformed

    private void txtPhoneNKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPhoneNKeyReleased
        // TODO add your handling code here:
        txtPhoneN.setText(txtPhoneN.getText().replaceAll("[a-zA-Z!@#$%^&*()=+]", ""));
    }//GEN-LAST:event_txtPhoneNKeyReleased

    private void txtCustomerNameKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCustomerNameKeyReleased
        // TODO add your handling code here:
        txtCustomerName.setText(txtCustomerName.getText().replaceAll("[!@#$%^&*()=+]", ""));
    }//GEN-LAST:event_txtCustomerNameKeyReleased

 
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btADD;
    private javax.swing.JButton btnNew;
    private javax.swing.JComboBox cbTypeparce;
    private javax.swing.JComboBox cbWeight;
    private javax.swing.JComboBox cbxFrom;
    private javax.swing.JComboBox cbxTo;
    private javax.swing.JInternalFrame itfVS;
    private javax.swing.JDesktopPane jDesktopPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JPanel jpCheckout;
    private javax.swing.JPanel jpInformationparcel;
    private javax.swing.JPanel jpInformationvotessent;
    private javax.swing.JLabel lbCostsincurred;
    private javax.swing.JLabel lbCustomerName;
    private javax.swing.JLabel lbCustomersID;
    private javax.swing.JLabel lbDate;
    private javax.swing.JLabel lbDate1;
    private javax.swing.JLabel lbDeliveryaddress;
    private javax.swing.JLabel lbDiachiKH;
    private javax.swing.JLabel lbEmployeeT;
    private javax.swing.JLabel lbEmployeeV;
    private javax.swing.JLabel lbPhoneN;
    private javax.swing.JLabel lbShippingfee;
    private javax.swing.JLabel lbTotalamount;
    private javax.swing.JLabel lbTypeparce;
    private javax.swing.JLabel lbUCostsincurred;
    private javax.swing.JLabel lbUShippingfee;
    private javax.swing.JLabel lbUTotalamount;
    private javax.swing.JLabel lbVS;
    private javax.swing.JLabel lbWaybill;
    private javax.swing.JLabel lbWaybill1;
    private javax.swing.JLabel lbWeight;
    private javax.swing.JLabel lblFrom;
    private javax.swing.JLabel lblTo;
    private javax.swing.JTextField tfCostsincurred;
    private javax.swing.JTextField tfDeliveryaddress;
    private javax.swing.JTextField tfShippingfee;
    private javax.swing.JTextField tfTotalamount;
    private javax.swing.JTextField txtCustomerName;
    private javax.swing.JTextField txtCustomersID;
    private javax.swing.JTextField txtPhoneN;
    private javax.swing.JTextArea txtaCAddress;
    // End of variables declaration//GEN-END:variables
}
